package com.likl.service.impl;

import com.likl.service.SendMailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

/**
 * ClassName:springboot_study
 * Description:
 *
 * @Create: 2024/7/16 17:13
 * @author: likl
 * @e-mail: likl1102@foxmail.com
 * @QQ: 2514927731
 */
//@Service
public class SendMailServiceImpl implements SendMailService {

    @Autowired
    private JavaMailSender javaMailSender;

    private String from = "2514927731@qq.com";

    private String to = "likl@fiberhome.com";

    private String subject = "测试邮件";

    private String context = "测试邮件正文内容123";

    @Override
    public void sendMail() {
        SimpleMailMessage messages = new SimpleMailMessage();
        messages.setFrom(from);
        messages.setTo(to);
        messages.setSubject(subject);
        messages.setText(context);
        javaMailSender.send(messages);
    }
}
